package com.weichen.studentgameexchange.game.controller;

import com.weichen.studentgameexchange.game.entity.Game;
import com.weichen.studentgameexchange.game.service.IGameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 功能：
 * 作者：惟尘
 * 日期：2025/2/4 11:08
 */
@RestController
@RequestMapping("/game")
public class FeignController {

    @Autowired
    IGameService gameService;

    @GetMapping("/{gameId}")
    public Game getGameById(@PathVariable Long gameId) {
        return gameService.getById(gameId);
    }

    @PostMapping("/batch/")
    public List<Game> getGamesByIds(@RequestBody List<Long> gameIds) {
        return gameService.getGamesByIds(gameIds);
    }

    @GetMapping("/getId")
    public Game getGameId(@RequestParam("gameName") String gameName) {
        return gameService.getGameId(gameName);
    }


    @GetMapping("/getIds")
    public List<Game> getLikeGame(@RequestParam("gameName") String gameName) {
        return gameService.getLikeGame(gameName);
    }
}